<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@ page trimDirectiveWhitespaces="true"%>

<jsp:useBean id="manager" class="beans.AuthBean" scope="request">
    <c:set target="${manager}" property="request" value="${pageContext.request}" />
    <c:set target="${manager}" property="response" value="${pageContext.response}" />
    <c:set target="${manager}" property="session" value="${pageContext.session}" />
</jsp:useBean>
<c:choose>
    <c:when test="${manager.load == true}">
   <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="stylesheet" href="core/css/style.css" type="text/css" />
            <link type="text/css" href="core/css/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />	
            <script type="text/javascript" src="core/js/script.js" ></script> 
            <title>Авторизация</title>
        </head>
        <body>
           <h1>Авторизация</h1>
            <br />
            <form name="form_login" method="POST">
                <table border="0">
                    <thead>
                        <tr>
                            <th></th>
                            <th></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="regFormStatusPic"><image id="login_StatusPic" src="core/images/misc/error.png" alt="" style="display: none" /></td>
                            <td><input type="text" id="login" name="login" value="" maxlength="50" class="regFormInput" /></td>
                            <td><label for="login">Логин</label><br /></td>
                        </tr>
                        <tr>
                            <td class="regFormStatusPic"><image id="pass_StatusPic" src="core/images/misc/error.png" alt="" style="display: none" /></td>
                            <td><input type="password" id="pass" value="" maxlength="255" class="regFormInput" /></td>
                            <td><label for="pass">Пароль</label><br /></td>
                        </tr>
                        <tr>
                            <td><image id="ajaxStatusLogin" src="core/images/misc/ajax-loader.gif" alt="" style="display: none" /></td>
                            <td>
                                <input id="btnLoginSubmit" type="button" value="Войти" onclick="doLogin();"/>
                                <input type="button" value="Регистрация" onclick="window.location = 'register.jsp';"/>
                            </td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </form>
            
            <div id="dialog-modal"></div>
        </body>
    </html>        
    </c:when>
    <c:when test="${manager.load == false}">
        <c:redirect url="chat.jsp"></c:redirect>
    </c:when>    
</c:choose>